From 5b7c23392d75ac1c47f920b15faeee2333e83de8 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Wed, 26 Oct 2005 23:13:36 +0000 Subject: [PATCH] Added support for CompeGPS data files --- gpsbabel/Makefile | 3 +- gpsbabel/README | 19 + gpsbabel/compegps.c | 639 ++++++++++++++++++++++ gpsbabel/csv_util.c | 2 +- gpsbabel/csv_util.h | 3 + gpsbabel/reference/compegps-wpt.gpx | 178 ++++++ gpsbabel/reference/compegps.wpt | 52 ++ gpsbabel/reference/route/compegps-rte.gpx | 47 ++ gpsbabel/reference/route/compegps.rte | 20 + gpsbabel/reference/track/compegps-trk.gpx | 182 ++++++ gpsbabel/reference/track/compegps.trk | 53 ++ gpsbabel/testo | 22 + gpsbabel/vecs.c | 7 + 13 files changed, 1225 insertions(+), 2 deletions(-) create mode 100644 gpsbabel/compegps.c create mode 100644 gpsbabel/reference/compegps-wpt.gpx create mode 100644 gpsbabel/reference/compegps.wpt create mode 100644 gpsbabel/reference/route/compegps-rte.gpx create mode 100644 gpsbabel/reference/route/compegps.rte create mode 100644 gpsbabel/reference/track/compegps-trk.gpx create mode 100644 gpsbabel/reference/track/compegps.trk diff --git a/gpsbabel/Makefile b/gpsbabel/Makefile index ab767d236..2c89b102f 100644 --- a/gpsbabel/Makefile +++ b/gpsbabel/Makefile @@ -39,7 +39,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \ igc.o brauniger_iq.o shape.o hiketech.o glogbook.o coastexp.o \ vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \ tef_xml.o maggeo.o pathaway.o vitosmt.o gdb.o bcr.o coto.o \ - ignrando.o stmwpp.o msroute.o cst.o nmn4.o mag_pdb.o + ignrando.o stmwpp.o msroute.o cst.o nmn4.o mag_pdb.o compegps.o FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o reverse_route.o sort.o stackfilter.o trackfilter.o discard.o @@ -155,6 +155,7 @@ brauniger_iq.o: brauniger_iq.c defs.h queue.h gbtypes.h jeeps/gpsserial.h \ jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h cetus.o: cetus.c defs.h queue.h gbtypes.h coldsync/palm.h coldsync/pdb.h coastexp.o: coastexp.c defs.h queue.h gbtypes.h xmlgeneric.h uuid.h cet_util.h +compegps.o: compegps.c defs.h queue.h gbtypes.h csv_util.h copilot.o: copilot.c defs.h queue.h gbtypes.h coldsync/palm.h \ coldsync/pdb.h coto.o: coto.c defs.h queue.h gbtypes.h csv_util.h coldsync/palm.h \ diff --git a/gpsbabel/README b/gpsbabel/README index 02d8d3522..a383ede79 100644 --- a/gpsbabel/README +++ b/gpsbabel/README @@ -1178,6 +1178,25 @@ THE FORMATS and (maybe) other software. The exported files can contain maps and/or route descriptions. The reader for this format has been tested with PowerRoute 5+6, Motorrad-Routenplaner 2002(-2006). + + CompeGPS + + Support for CompeGPS data files. + These data files are "character" separated text files like the pcx + format. "Character" means special data lines can have their own + separator. + + Since release 6.1 GPX is a also a supported import/export format for + waypoints, routes and tracks. + + For more information please have a look at + + http://www.compegps.com + + Options: + + index: Index of route/track + snlen: Length of generated short names (default 16) DATA FILTERS diff --git a/gpsbabel/compegps.c b/gpsbabel/compegps.c new file mode 100644 index 000000000..7f517512f --- /dev/null +++ b/gpsbabel/compegps.c @@ -0,0 +1,639 @@ +/* + + Support for CompeGPS waypoint (.wpt), route (.rte) and track (.trk) files, + + Copyright (C) 2005 Olaf Klein, o.b.klein@t-online.de + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA +*/ + +/* + History: + 10/23/2005: First release; only a reader + 10/25/2005: becomes a writer too + 10/26/2005: received documention from CompeGPS team + added fatals for "G" and "U" if not WGS84 and lat/lon +*/ + +/* + + the meaning of leading characters in CompeGPS data lines (enhanced PCX): + + header lines: + + "G": WGS 84 - Datum of the map + "N": Anybody - Name of the user + "L": -02:00:00 - Difference to UTC + "M": ... - Any comments + "R": 16711680 , xxxx , 1 - Route header + "U": 1 - System of coordinates (0=UTM 1=Latitude/Longitude) + + "C": 0 0 255 2 -1.000000 - ??? + "V": 0.0 0.0 0 0 0 0 0.0 - ??? + "E": 0|1|00-NUL-00 00:00:00|00:00:00|0 - ??? + + data lines: + + "W": if(route) routepoint; else waypoint + "T": trackpoint + "t": if(track) additionally track info + if(!track) additionally trackpoint info + "a": link to ... + "w": waypoint additional info + +*/ + +#include "defs.h" +#include "csv_util.h" + +#include +#include +#include +#include +#include + +#define MYNAME "CompeGPS" + +#define SHORT_NAME_LENGTH 16 + +static FILE *fin, *fout; +static char *fin_name, *fout_name; +static int target_index, curr_index; +static int track_info_flag; +static short_handle sh; +static int snlen; +static int radius; + +static route_head *curr_track; +static route_head *curr_route; + +/* placeholders for options */ + +static char *option_icon; +static char *option_index; +static char *option_radius; +static char *option_snlen; + +static +arglist_t compegps_args[] = { + {"deficon", &option_icon, "Default icon name", + NULL, ARGTYPE_STRING}, + {"index", &option_index, "Index of route/track to write (if more the one in source)", + NULL, ARGTYPE_INT}, + {"radius", &option_radius, "Give points (waypoints/route points) a default radius", + NULL, ARGTYPE_FLOAT}, + {"snlen", &option_snlen, "Length of generated shortnames (default 16)", + NULL, ARGTYPE_INT}, + {0, 0, 0, 0, 0} +}; + +/* specialized readers */ + +static waypoint* +parse_wpt(char *buff) +{ + int col = -1; + char *c, *cend, *cx; + waypoint *wpt = waypt_new(); + + c = strstr(buff, "A "); + if (c == buff) col++; + + c = csv_lineparse(buff, " ", "", col++); + while (c != NULL) + { + c = lrtrim(c); + if (*c != '\0') + { +#if 0 + printf(MYNAME "_read_wpt: col(%d)=%s\n", col, c); +#endif + switch(col) + { + case 0: + + cx = c + strlen(c) - 1; /* trim trailing underscores */ + while ((cx >= c) && (*cx == '_')) *cx-- = '\0'; + if (*c != '\0') + wpt->shortname = xstrdup(c); + break; + case 2: + human_to_dec(c, &wpt->latitude, NULL, 1); + break; + case 3: + human_to_dec(c, NULL, &wpt->longitude, 2); + break; + case 4: break; /* Unused date and time */ + case 5: break; /* always "27-MAR-62 00:00:00" */ + case 6: + wpt->altitude = atof(c); + break; + case 7: + wpt->description = xstrdup(c); + break; + default: + if (col > 7) + { + wpt->description = xstrappend(wpt->description, " "); + wpt->description = xstrappend(wpt->description, c); + } + } + } + c = csv_lineparse(NULL, " ", "", col++); + } + return wpt; +} + +static void +parse_wpt_info(const char *buff, waypoint *wpt) /* "w" */ +{ + char *c; + int col = -1; + double fx; + + c = csv_lineparse(buff, ",", "", col++); + while (c != NULL) + { + c = lrtrim(c); + if (*c != '\0') + { +#if 0 + printf(MYNAME "_read_wpt_info: col(%d)=%s\n", col, c); +#endif + switch(col) + { + case 0: + wpt->icon_descr = xstrdup(c); + wpt->wpt_flags.icon_descr_is_dynamic = 1; + break; + case 1: break; /* Text postion */ + case 2: break; /* Lens zoom level */ + case 3: break; /* Text colour */ + case 4: break; /* Background colour */ + case 5: break; /* Transparent text  (0=transparent, 1=no transparent) */ + case 6: break; /* ??? */ + case 7: break; /* ??? */ + case 8: /* radius */ + fx = atof(c); + if (fx > 0) + wpt->proximity = fx; + break; + } + } + c = csv_lineparse(NULL, ",", "", col++); + } +} + +static waypoint * +parse_trkpt(char *buff) +{ + int col = -1; + char *c; + struct tm tm; + char month[4]; + waypoint *wpt = waypt_new(); + + c = strstr(buff, "A "); + if (c == buff) col++; + + memset(&tm, 0, sizeof(tm)); + c = csv_lineparse(buff, " ", "", col++); + while (c != NULL) + { + c = lrtrim(c); + if (*c != '\0') + { +#if 0 + printf(MYNAME "_read_trkpt: col(%d)=%s\n", col, c); +#endif + switch(col) + { + case 2: + human_to_dec(c, &wpt->latitude, NULL, 1); + break; + case 3: + human_to_dec(c, NULL, &wpt->longitude, 2); + break; + case 4: + tm.tm_mday = atoi(c); + strncpy(month, c+3, 3); + month[3] = 0; + tm.tm_mon = month_lookup(month); + tm.tm_year = atoi(c + 7); + if (tm.tm_year < 70) tm.tm_year += 100; + break; + case 5: + tm.tm_hour = atoi(c); + tm.tm_min = atoi(c+3); + tm.tm_sec = atoi(c+6); + wpt->creation_time = mkgmtime(&tm); + break; + case 7: + wpt->altitude = atof(c); + break; + } + } + c = csv_lineparse(NULL, " ", "", col++); + } + return wpt; +} + +static void +parse_track_info(const char *buff, route_head *track) /* "t" */ +{ + char *c; + int col = -1; + + c = csv_lineparse(buff, "|", "", col++); + while (c != NULL) + { + c = lrtrim(c); + if (*c != '\0') + { +#if 0 + printf(MYNAME "_read_track_info: col(%d)=%s\n", col, c); +#endif + switch(col) + { + case 0: + break; /* unknown field */ + case 1: + track->rte_name = xstrdup(c); + break; + case 2: + break; /* unknown field */ + case 3: + break; /* unknown field */ + } + } + c = csv_lineparse(NULL, "|", "", col++); + } +} + +static void +parse_rte_info(const char *buff, route_head *route) /* "R" */ +{ + char *c; + int col = -1; + + c = csv_lineparse(buff, ",", "", col++); + while (c != NULL) + { + c = lrtrim(c); + if (*c != '\0') + { +#if 0 + printf(MYNAME "_read_rte_info: col(%d)=%s\n", col, c); +#endif + switch(col) + { + case 0: break; /* unknown field (colour?) */ + case 1: + route->rte_name = xstrdup(c); + break; + case 2: break; /* unknown field */ + + } + } + c = csv_lineparse(NULL, ",", "", col++); + } +} + +/* main functions */ + +static void +compegps_rd_init(const char *fname) +{ + fin_name = (char *)fname; + fin = xfopen(fname, "r", MYNAME); +} + +static void +compegps_rd_deinit(void) +{ + fclose(fin); +} + +static void +compegps_data_read(void) +{ + char buff[1024]; + int line = 0; + waypoint *wpt; + route_head *route = NULL; + route_head *track = NULL; + + while (NULL != fgets(buff, sizeof(buff), fin)) + { + char *cin = buff; + char *ctail, *cx; + + line++; + cin = lrtrim(buff); + if (strlen(cin) == 0) continue; + + ctail = strchr(cin, ' '); + if (ctail == NULL) continue; + ctail = lrtrim(ctail); + + switch(*cin) + { + case 'G': + cx = csv_stringclean(ctail, " "); + is_fatal((strcmp(cx, "WGS84") != 0), MYNAME ": Unsupported datum \"%s\"!", ctail); + xfree(cx); + break; + case 'U': + switch(*ctail) + { + case '1': /* lat/lon, that's we want to see */ + break; + case '0': /* UTM not supported yet */ + fatal(MYNAME "Sorry, UTM is not supported yet!\n"); + default: + fatal(MYNAME "Invalid system of coordinates (%s)!\n", cin); + } + break; + case 'R': + route = route_head_alloc(); + route_add_head(route); + parse_rte_info(ctail, route); + break; + case 'M': + break; + case 'W': + wpt = parse_wpt(ctail); + if (wpt != NULL) + { + if (route != NULL) + route_add_wpt(route, wpt); + else + waypt_add(wpt); + } + break; + case 'w': + is_fatal((wpt == NULL), MYNAME ": No waypoint data before \"%s\"!", cin); + parse_wpt_info(ctail, wpt); + break; + case 'T': + wpt = parse_trkpt(ctail); + if (wpt != NULL) + { + if (track == NULL) + { + track = route_head_alloc(); + track_add_head(track); + } + route_add_wpt(track, wpt); + } + break; + case 't': + if (track != NULL) + parse_track_info(ctail, track); + break; + } + } +} + +/* ----------------------------------------------------------- */ + +static void +write_waypt_cb(const waypoint *wpt) +{ + char *name; + + if (curr_index != target_index ) return; + + name = (snlen > 0) ? mkshort_from_wpt(sh, wpt) : csv_stringclean(wpt->shortname, " "); + + fprintf(fout, "W %s A ", name); + fprintf(fout, "%.10f%c%c ", + wpt->latitude, 0xBA, (wpt->latitude >= 0) ? 'N' : 'S'); + fprintf(fout, "%.10f%c%c ", + wpt->longitude, 0xBA, (wpt->longitude >= 0) ? 'E' : 'W'); + fprintf(fout, "27-MAR-62 00:00:00 %.6f", + (wpt->altitude != unknown_alt) ? wpt->altitude : 0.0); + if (wpt->description != NULL) + fprintf(fout, " %s", wpt->description); + fprintf(fout, "\n"); + + if ((wpt->icon_descr != NULL) || (wpt->proximity > 0.0) || \ + (option_icon != NULL)) + { + char *icon = option_icon; + + if (wpt->icon_descr != NULL) icon = wpt->icon_descr; + + fprintf(fout, "w %s,0,0.0,16777215,255,1,7,,%.1f\n", + (icon != NULL) ? icon : "Waypoint", + (wpt->proximity > 0.0f) ? wpt->proximity : 0.0); + } + xfree(name); +} + +static void +write_route_hdr_cb(const route_head *rte) +{ + char *name; + curr_route = (route_head *) rte; + curr_index++; + if (curr_index != target_index) return; + + name = rte->rte_name; + if (name != NULL) + name = csv_stringclean(name, ","); + else + name = xstrdup(" "); + fprintf(fout, "R 16711680,%s,1,-1\n", name); + xfree(name); +} + +static void +write_route(void) +{ + curr_index = 0; + route_disp_all(write_route_hdr_cb, NULL, write_waypt_cb); +} + +static void +write_track_hdr_cb(const route_head *trk) +{ + track_info_flag = 0; + curr_track = (route_head *) trk; + + curr_index++; + if (curr_index != target_index) return; + + track_info_flag = 1; +} + +static void +write_trkpt_cb(const waypoint *wpt) +{ + char buff[128]; + struct tm tm; + + if ((curr_index != target_index) || (wpt == NULL)) return; + + buff[0] = '\0'; + + if (wpt->creation_time != 0) + { + char *cx = &buff; + tm = *gmtime(&wpt->creation_time); + strftime(buff, sizeof(buff), "%d-%b-%y %H:%M:%S", &tm); + while (*cx != '\0') + { + *cx = toupper(*cx); + cx++; + } + } + + fprintf(fout, "T A %.10f%c%c %.10f%c%c ", + wpt->latitude, 0xBA, (wpt->latitude >= 0) ? 'N' : 'S', + wpt->longitude, 0xBA, (wpt->longitude >= 0) ? 'E' : 'W'); + fprintf(fout, "%s s %.1f %.1f %.1f %.1f %d ", + buff, + wpt->altitude, + 0.0, + 0.0, + 0.0, + 0); + fprintf(fout, "%.1f %.1f %.1f %.1f %.1f\n", + -1000.0, + -1.0, + -1.0, + -1.0, + -1.0); + if (track_info_flag != 0) + { + track_info_flag = 0; + if (curr_track->rte_name != NULL) + { + char *name; + + name = csv_stringclean(curr_track->rte_name, "|"); + fprintf(fout, "t 4294967295|%s|-1|-1\n", name); + xfree(name); + } + } +} + +static void +write_track(void) +{ + curr_index = 0; + +// fprintf(fout, "L +02:00:00\n"); + track_disp_all(write_track_hdr_cb, NULL, write_trkpt_cb); + fprintf(fout, "F 1234\n"); +} + +static void +write_waypoints(void) +{ + waypt_disp_all(write_waypt_cb); +} + +/* --------------------------------------------------------------------------- */ + +static void +compegps_wr_init(const char *fname) +{ + fout_name = (char *)fname; + fout = xfopen(fname, "w", MYNAME); + sh = mkshort_new_handle(); +} + +static void +compegps_wr_deinit(void) +{ + mkshort_del_handle(&sh); + fclose(fout); +} + +static void +compegps_data_write(void) +{ + /* because of different file extensions we can only write one GPS data type at time */ + + fprintf(fout, "G WGS 84\n"); + fprintf(fout, "U 1\n"); + + /* process options */ + + target_index = 1; + if (option_index != NULL) + target_index = atoi(option_index); + + snlen = 0; + if (global_opts.synthesize_shortnames != 0) + { + if (option_snlen != NULL) + snlen = atoi(option_snlen); + else + snlen = SHORT_NAME_LENGTH; + + is_fatal((snlen < 1), MYNAME "Invalid length for generated shortnames!"); + + setshort_whitespace_ok(sh, 0); + setshort_length(sh, snlen); + } + + radius = -1; + if (option_radius != 0) + { + radius = atof(option_radius); + is_fatal((radius <= 0.0), MYNAME "Invalid value for radius!"); + } + + if (option_icon != NULL) + { + if (*option_icon == '\0') + option_icon = NULL; + else if (case_ignore_strcmp(option_icon, "deficon") == 0) + option_icon = NULL; + } + + switch(global_opts.objective) + { + case wptdata: + curr_index = target_index = 0; + write_waypoints(); + break; + case trkdata: + write_track(); + break; + case rtedata: + write_route(); + break; + } +} + +/* --------------------------------------------------------------------------- */ + +ff_vecs_t compegps_vecs = { + ff_type_file, + FF_CAP_RW_ALL, + compegps_rd_init, + compegps_wr_init, + compegps_rd_deinit, + compegps_wr_deinit, + compegps_data_read, + compegps_data_write, + NULL, + compegps_args, + CET_CHARSET_MS_ANSI, 1 +}; diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 6292596e7..6bfbfc786 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -349,7 +349,7 @@ decdir_to_dec(const char * decdir) * which: 0-no preference 1-prefer lat 2-prefer lon *****************************************************************************/ -static void +void human_to_dec( const char *instr, double *outlat, double *outlon, int which ) { double unk[3] = {999,999,999}; diff --git a/gpsbabel/csv_util.h b/gpsbabel/csv_util.h index c8257726f..a69803e74 100644 --- a/gpsbabel/csv_util.h +++ b/gpsbabel/csv_util.h @@ -30,6 +30,9 @@ CSV_STRINGTRIM(const char *string, const char *enclosure, int strip_max, DEBUG_P char * csv_lineparse(const char *stringstart, const char *delimited_by, const char *enclosed_in, const int line_no); +void +human_to_dec( const char *instr, double *outlat, double *outlon, int which ); + char * #ifndef DEBUG_MEM csv_stringclean(const char *string, const char *chararray); diff --git a/gpsbabel/reference/compegps-wpt.gpx b/gpsbabel/reference/compegps-wpt.gpx new file mode 100644 index 000000000..42f775103 --- /dev/null +++ b/gpsbabel/reference/compegps-wpt.gpx @@ -0,0 +1,178 @@ + + + + + + 1400.000000 + F01140 + DECOLLO MONTE AVENA + DECOLLO MONTE AVENA + Waypoint + + + 300.000000 + F02030 + AVIOSUPERFICE FELTRE + AVIOSUPERFICE FELTRE + Waypoint + + + 230.000000 + F03023 + ATTERRAGGIO VALENTINE + ATTERRAGGIO VALENTINE + Waypoint + + + 320.000000 + F04032 + ATTERRAG. BIRRERIA PEDAVENA + ATTERRAG. BIRRERIA PEDAVENA + Waypoint + + + 420.000000 + F06042 + DIGA DEL MIS + DIGA DEL MIS + Waypoint + + + 460.000000 + F07046 + SOSPIROLO CHIESA + SOSPIROLO CHIESA + Waypoint + + + 450.000000 + F08045 + CESIOMAGGIORE FABBRICA + CESIOMAGGIORE FABBRICA + Waypoint + + + 290.000000 + F09029 + CARTIERA SGIUSTINA + CARTIERA SGIUSTINA + Waypoint + + + 380.000000 + F10038 + SEREN DEL GRAPPA CHIESA + SEREN DEL GRAPPA CHIESA + Waypoint + + + 346.900000 + F11031 + ARTEN FELTRE + ARTEN FELTRE + Waypoint + + + 450.000000 + F12045 + NORCEN CAMPI DA TENNIS + NORCEN CAMPI DA TENNIS + Waypoint + + + 380.000000 + F13038 + SOSPIROLO CAVA + SOSPIROLO CAVA + Waypoint + + + 1010.000000 + F14101 + COL MELON RIF BELVEDERE + COL MELON RIF BELVEDERE + Waypoint + + + 310.000000 + F15031 + FONZASO SPORTFUL + FONZASO SPORTFUL + Waypoint + + + 252.300000 + F16025 + BUSCHE LATTERIA + BUSCHE LATTERIA + Waypoint + + + 605.000000 + F17063 + LAMON + LAMON + Waypoint + + + 509.400000 + F18051 + ARSIE' + ARSIE' + Waypoint + + + 271.200000 + F19027 + CASTELLO DI FELTRE + CASTELLO DI FELTRE + Waypoint + + + 300.000000 + F20030 + SANTA LUCIA CHIESETTA + SANTA LUCIA CHIESETTA + Waypoint + + + 1430.000000 + F21143 + MALGA CAMPON + MALGA CAMPON + Waypoint + + + 300.000000 + F22030 + ZANUSSI MEL + ZANUSSI MEL + Waypoint + + + 270.000000 + F23027 + FELTRE OSPEDALE + FELTRE OSPEDALE + Waypoint + + + 860.000000 + F24086 + BAILO CASTEL TESINO + BAILO CASTEL TESINO + Waypoint + + + 450.000000 + F25045 + CASA SCEICCO + CASA SCEICCO + Waypoint + + diff --git a/gpsbabel/reference/compegps.wpt b/gpsbabel/reference/compegps.wpt new file mode 100644 index 000000000..722547566 --- /dev/null +++ b/gpsbabel/reference/compegps.wpt @@ -0,0 +1,52 @@ +G WGS 84 +U 1 +W F01140 A 46.0294899313ºN 11.8258790855ºE 27-MAR-62 00:00:00 1400.000000 DECOLLO MONTE AVENA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F02030 A 46.0086266116ºN 11.8609316981ºE 27-MAR-62 00:00:00 300.000000 AVIOSUPERFICE FELTRE +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F03023 A 46.0211500041ºN 11.8854800796ºE 27-MAR-62 00:00:00 230.000000 ATTERRAGGIO VALENTINE +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F04032 A 46.0335865765ºN 11.8823672293ºE 27-MAR-62 00:00:00 320.000000 ATTERRAG. BIRRERIA PEDAVENA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F06042 A 46.1598476455ºN 12.0832581003ºE 27-MAR-62 00:00:00 420.000000 DIGA DEL MIS +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F07046 A 46.1441766659ºN 12.0754755514ºE 27-MAR-62 00:00:00 460.000000 SOSPIROLO CHIESA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F08045 A 46.0812815292ºN 11.9856990105ºE 27-MAR-62 00:00:00 450.000000 CESIOMAGGIORE FABBRICA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F09029 A 46.0755574914ºN 12.0333107491ºE 27-MAR-62 00:00:00 290.000000 CARTIERA SGIUSTINA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F10038 A 45.9885384730ºN 11.8450206880ºE 27-MAR-62 00:00:00 380.000000 SEREN DEL GRAPPA CHIESA +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F11031 A 46.0105131183ºN 11.8303758183ºE 27-MAR-62 00:00:00 346.900000 ARTEN FELTRE +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F12045 A 46.0478971020ºN 11.8738181282ºE 27-MAR-62 00:00:00 450.000000 NORCEN CAMPI DA TENNIS +w Waypoint,0,0.0,16777215,255,1,7,,10.0 +W F13038 A 46.1529066825ºN 12.1211567478ºE 27-MAR-62 00:00:00 380.000000 SOSPIROLO CAVA +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F14101 A 46.0427458323ºN 11.8523925232ºE 27-MAR-62 00:00:00 1010.000000 COL MELON RIF BELVEDERE +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F15031 A 46.0108797603ºN 11.8137179459ºE 27-MAR-62 00:00:00 310.000000 FONZASO SPORTFUL +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F16025 A 46.0406235353ºN 11.9840491129ºE 27-MAR-62 00:00:00 252.300000 BUSCHE LATTERIA +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F17063 A 46.0469308434ºN 11.7485280506ºE 27-MAR-62 00:00:00 605.000000 LAMON +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F18051 A 45.9916739281ºN 11.7463576240ºE 27-MAR-62 00:00:00 509.400000 ARSIE' +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F19027 A 46.0189789055ºN 11.9110897654ºE 27-MAR-62 00:00:00 271.200000 CASTELLO DI FELTRE +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F20030 A 46.0114906453ºN 11.8334226329ºE 27-MAR-62 00:00:00 300.000000 SANTA LUCIA CHIESETTA +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F21143 A 46.0399765040ºN 11.8254835151ºE 27-MAR-62 00:00:00 1430.000000 MALGA CAMPON +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F22030 A 46.0508253483ºN 12.0619251800ºE 27-MAR-62 00:00:00 300.000000 ZANUSSI MEL +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F23027 A 46.0220149684ºN 11.9077995458ºE 27-MAR-62 00:00:00 270.000000 FELTRE OSPEDALE +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F24086 A 46.0632841167ºN 11.6096598449ºE 27-MAR-62 00:00:00 860.000000 BAILO CASTEL TESINO +w Waypoint,0,0.0,16777215,255,1,7,,0.0 +W F25045 A 46.0571933560ºN 11.8888581427ºE 27-MAR-62 00:00:00 450.000000 CASA SCEICCO +w Waypoint,0,0.0,16777215,255,1,7,,0.0 + + diff --git a/gpsbabel/reference/route/compegps-rte.gpx b/gpsbabel/reference/route/compegps-rte.gpx new file mode 100644 index 000000000..1ac52bc5e --- /dev/null +++ b/gpsbabel/reference/route/compegps-rte.gpx @@ -0,0 +1,47 @@ + + + + + test + + 0.000000 + V03087 + Waypoint + + + 0.000000 + V05027 + Waypoint + + + 0.000000 + V06080 + Waypoint + + + 0.000000 + V04041 + Waypoint + + + 0.000000 + V09058 + Waypoint + + + 0.000000 + V10025 + Waypoint + + + 0.000000 + V02023 + Waypoint + + + diff --git a/gpsbabel/reference/route/compegps.rte b/gpsbabel/reference/route/compegps.rte new file mode 100644 index 000000000..f07304ede --- /dev/null +++ b/gpsbabel/reference/route/compegps.rte @@ -0,0 +1,20 @@ +G WGS 84 + U 1 + R 16711680 , test , 1 , -1 + W V03087__________ A 45.7893830000ºN 11.5535830000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V05027__________ A 45.7758000000ºN 11.4499670000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V06080__________ A 45.7848830000ºN 11.5444170000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V04041__________ A 45.7544670000ºN 11.4939500000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V09058__________ A 45.7830830000ºN 11.4590830000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V10025__________ A 45.7605830000ºN 11.4496170000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + W V02023__________ A 45.7659500000ºN 11.4806170000ºE 27-MAR-62 00:00:00 0.000000 + w Waypoint , 0 , -1.0 , 16777215 , 255 , 1 , 7 , , 0.0 + + + \ No newline at end of file diff --git a/gpsbabel/reference/track/compegps-trk.gpx b/gpsbabel/reference/track/compegps-trk.gpx new file mode 100644 index 000000000..a291deefa --- /dev/null +++ b/gpsbabel/reference/track/compegps-trk.gpx @@ -0,0 +1,182 @@ + + + + + ACTIVE LOG 006 + + + 161.000000 + + + + 154.000000 + + + + 148.000000 + + + + 139.000000 + + + + 145.000000 + + + + 134.000000 + + + + 131.000000 + + + + 130.000000 + + + + 132.000000 + + + + 144.000000 + + + + 147.000000 + + + + 145.000000 + + + + 145.000000 + + + + 135.000000 + + + + 135.000000 + + + + 136.000000 + + + + 135.000000 + + + + 139.000000 + + + + 139.000000 + + + + 141.000000 + + + + 140.000000 + + + + 140.000000 + + + + 152.000000 + + + + 152.000000 + + + + 155.000000 + + + + 149.000000 + + + + 150.000000 + + + + 151.000000 + + + + 151.000000 + + + + 150.000000 + + + + 150.000000 + + + + 150.000000 + + + + 150.000000 + + + + 143.000000 + + + + 141.000000 + + + + 143.000000 + + + + 139.000000 + + + + 139.000000 + + + + 138.000000 + + + + 139.000000 + + + + 144.000000 + + + + 145.000000 + + + + + diff --git a/gpsbabel/reference/track/compegps.trk b/gpsbabel/reference/track/compegps.trk new file mode 100644 index 000000000..dc0c04f09 --- /dev/null +++ b/gpsbabel/reference/track/compegps.trk @@ -0,0 +1,53 @@ +G WGS 84 +U 1 +N oliskoli +D Leipzig +C 119 119 0 2 -1.000000 +L 02:00:00 +V 0.0 0.0 0 0 0 0 0.0 +M No comment +E 0|1|00-NUL-00 00:00:00|00:00:00|0 +T A 51.3129500000ºN 12.4131666667ºE 01-MAY-05 13:02:47 N 161.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +t 4294967295|ACTIVE LOG 006|-1|-1 +T A 51.3128833333ºN 12.4132333333ºE 01-MAY-05 13:03:25 s 154.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3128666667ºN 12.4132333333ºE 01-MAY-05 13:03:39 s 148.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3128166667ºN 12.4133000000ºE 01-MAY-05 13:04:16 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3128333333ºN 12.4132666667ºE 01-MAY-05 13:05:02 s 145.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3128333333ºN 12.4133166667ºE 01-MAY-05 13:05:45 s 134.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3127833333ºN 12.4133500000ºE 01-MAY-05 13:06:44 s 131.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3127833333ºN 12.4133333333ºE 01-MAY-05 13:07:50 s 130.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3127500000ºN 12.4133333333ºE 01-MAY-05 13:08:19 s 132.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3128166667ºN 12.4133166667ºE 01-MAY-05 13:11:16 s 144.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129333333ºN 12.4134500000ºE 01-MAY-05 13:12:34 s 147.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3130000000ºN 12.4138000000ºE 01-MAY-05 13:13:18 s 145.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3130500000ºN 12.4138166667ºE 01-MAY-05 13:13:27 s 145.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3130500000ºN 12.4138500000ºE 01-MAY-05 13:13:37 s 135.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3131166667ºN 12.4138500000ºE 01-MAY-05 13:13:46 s 135.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3132166667ºN 12.4138833333ºE 01-MAY-05 13:14:03 s 136.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3133000000ºN 12.4139666667ºE 01-MAY-05 13:14:16 s 135.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3132833333ºN 12.4140500000ºE 01-MAY-05 13:14:26 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3132666667ºN 12.4141000000ºE 01-MAY-05 13:14:30 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3130500000ºN 12.4146166667ºE 01-MAY-05 13:15:06 s 141.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129833333ºN 12.4148333333ºE 01-MAY-05 13:15:27 s 140.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129333333ºN 12.4149333333ºE 01-MAY-05 13:15:39 s 140.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129500000ºN 12.4149666667ºE 01-MAY-05 13:25:31 s 152.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129333333ºN 12.4149833333ºE 01-MAY-05 13:25:40 s 152.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3129666667ºN 12.4149500000ºE 01-MAY-05 13:29:18 s 155.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3131666667ºN 12.4146000000ºE 01-MAY-05 13:30:30 s 149.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3131666667ºN 12.4145666667ºE 01-MAY-05 13:30:37 s 150.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3131666667ºN 12.4144333333ºE 01-MAY-05 13:30:47 s 151.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3131500000ºN 12.4143833333ºE 01-MAY-05 13:30:48 s 151.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3133333333ºN 12.4139000000ºE 01-MAY-05 13:30:52 s 150.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3137000000ºN 12.4133166667ºE 01-MAY-05 13:30:57 s 150.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3139833333ºN 12.4128666667ºE 01-MAY-05 13:31:03 s 150.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3142166667ºN 12.4124833333ºE 01-MAY-05 13:31:10 s 150.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4095666667ºE 01-MAY-05 13:32:38 s 143.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4095000000ºE 01-MAY-05 13:32:45 s 141.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4095000000ºE 01-MAY-05 13:33:17 s 143.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4094500000ºE 01-MAY-05 13:33:42 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4093500000ºE 01-MAY-05 13:33:54 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4093500000ºE 01-MAY-05 13:34:04 s 138.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4093500000ºE 01-MAY-05 13:34:20 s 139.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4093500000ºE 01-MAY-05 13:35:45 s 144.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +T A 51.3146500000ºN 12.4093500000ºE 01-MAY-05 13:35:56 s 145.0 0.0 0.0 0.0 0 -1000.0 -1.0 -1.0 -1.0 +F 1234 diff --git a/gpsbabel/testo b/gpsbabel/testo index dd3100b7c..4998784ee 100755 --- a/gpsbabel/testo +++ b/gpsbabel/testo @@ -884,4 +884,26 @@ rm -f ${TMPDIR}/mag_pdb-* ${PNAME} -i mag_pdb -f reference/route/mag_pdb-sample.pdb -o gpx -F ${TMPDIR}/mag_pdb-sample.gpx compare ${TMPDIR}/mag_pdb-sample.gpx reference/route/mag_pdb-sample.gpx +# +# CompeGPS I/O tests +# +rm -f ${TMPDIR}/compegps* +# read (CompeGPS) +${PNAME} -i compegps -f reference/compegps.wpt -o gpx -F ${TMPDIR}/compegps-wpt.gpx +compare reference/compegps-wpt.gpx ${TMPDIR}/compegps-wpt.gpx +${PNAME} -i compegps -f reference/route/compegps.rte -o gpx -F ${TMPDIR}/compegps-rte.gpx +compare reference/route/compegps-rte.gpx ${TMPDIR}/compegps-rte.gpx +${PNAME} -i compegps -f reference/track/compegps.trk -o gpx -F ${TMPDIR}/compegps-trk.gpx +compare reference/track/compegps-trk.gpx ${TMPDIR}/compegps-trk.gpx +# write (CompeGPS) +${PNAME} -i compegps -f reference/compegps.wpt -o compegps -F ${TMPDIR}/compegps.wpt +${PNAME} -i compegps -f ${TMPDIR}/compegps.wpt -o gpx -F ${TMPDIR}/compegps-wpt2.gpx +compare reference/compegps-wpt.gpx ${TMPDIR}/compegps-wpt2.gpx +${PNAME} -t -i compegps -f reference/track/compegps.trk -o compegps -F ${TMPDIR}/compegps.trk +${PNAME} -i compegps -f ${TMPDIR}/compegps.trk -o gpx -F ${TMPDIR}/compegps-trk2.gpx +compare reference/track/compegps-trk.gpx ${TMPDIR}/compegps-trk2.gpx +${PNAME} -r -i compegps -f reference/route/compegps.rte -o compegps -F ${TMPDIR}/compegps.rte +${PNAME} -i compegps -f ${TMPDIR}/compegps.rte -o gpx -F ${TMPDIR}/compegps-rte2.gpx +compare reference/route/compegps-rte.gpx ${TMPDIR}/compegps-rte2.gpx + exit 0 diff --git a/gpsbabel/vecs.c b/gpsbabel/vecs.c index df3317261..e49863554 100644 --- a/gpsbabel/vecs.c +++ b/gpsbabel/vecs.c @@ -93,6 +93,7 @@ extern ff_vecs_t msroute_vecs; extern ff_vecs_t cst_vecs; extern ff_vecs_t nmn4_vecs; extern ff_vecs_t magpdb_vecs; +extern ff_vecs_t compegps_vecs; static vecs_t vec_list[] = { @@ -475,6 +476,12 @@ vecs_t vec_list[] = { "Map&Guide to Palm/OS exported files (.pdb)", "pdb" }, + { + &compegps_vecs, + "compegps", + "CompeGPS data files (.wpt/.trk/.rte)", + NULL + }, { NULL, NULL, -- 2.30.2